<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6" > <![endif]-->
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7" > <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8" > <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9" > <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"><!--<![endif]-->
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title><g:layoutTitle default="Grails"/></title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<link rel="shortcut icon" href="${resource(dir: 'images', file: 'favicon.ico')}" type="image/x-icon">
		<link rel="apple-touch-icon" href="${resource(dir: 'images', file: 'apple-touch-icon.png')}">
		<link rel="apple-touch-icon" sizes="114x114" href="${resource(dir: 'images', file: 'apple-touch-icon-retina.png')}">
		<link rel="stylesheet" href="${resource(dir: 'bootstrap-3.1.1-dist/css', file: 'bootstrap.min.css')}" type="text/css">
		<link rel="stylesheet" href="${resource(dir: 'css', file: 'main.css')}" type="text/css">
		<link rel="stylesheet" href="${resource(dir: 'css', file: 'mobile.css')}" type="text/css">
		<g:layoutHead/>
		<g:javascript library="jquery-ui"/>
		<g:javascript library="application"/>
		<g:javascript src="bootstrap/bootstrap.min.js"/>
		<r:layoutResources />
		
		<script type="text/javascript">
			function logout(){
				$.ajax({
					url:"${createLink(uri: '/logout')}",
					type: "POST",
					success:function(response){
						$(location).attr('href',"${createLink(uri: '/user/welcome')}");
						console.log("logout ok");
					},
					error:function(jqXHR, textStatus, errorThrown){
						console.log(jqXHR, textStatus, errorThrown);
					}
				});
			}
		</script>
	</head>
	<body class="row">
		<div class="contentBackground col-md-8 col-md-offset-2">
			<header class="row" id="grailsLogo">
				<div id="grailsLogo">
					<h1 id="ApplicationTitle">${message(code: 'title', default: 'Fleet Manager')}</h1>
				</div>				
				<sec:ifLoggedIn>
					${message(code: 'welcome.message', default: 'Welcome ')} <sec:username/>!					
					<form name="logout" method="POST" action="${createLink(controller:'logout') }">
						<input type="submit" value="logout">
					</form>
				</sec:ifLoggedIn>
			</header>

			<section class="row contentTest">
				<g:layoutBody />
			</section>

			<footer class="row">
				<r:layoutResources />
				<div id="spinner" class="spinner" style="display: none;">
					<g:message code="spinner.alt" default="Loading&hellip;" />
				</div>
			</footer>
		</div>
	</body>
</html>
